package ch.il07.converter.business;

import java.util.List;

import ch.il07.converter.persistence.entities.Unit;

public interface UnitAction extends Service {
	
	/**
	 * 
	 * updated the unit with the given unitID, all other parameters that are not null will get updated
	 * 
	 * @param username is null for public units
	 * @param unitID
	 * @param unitName
	 * @param factor
	 * @param shift
	 * @param symbol
	 * @return true on success, false on any error
	 */
	public boolean editUnit(String username, Integer unitID, String unitName, Double factor, Double shift, String symbol);
	
	/**
	 * 
	 * nominates a unit. an administrator will than be able to publish it / make it visible for all
	 * 
	 * @param unitID
	 * @return true on success, false on any error
	 */
	public boolean proposeUnitForPublic(Integer unitID);
	
	/**
	 * 
	 * deletes the unit with the given unitID
	 * 
	 * @param username is null for public units
	 * @param unitID
	 * @return true on success, false on any error
	 */
	public boolean deleteUnit(String username, Integer unitID);
	
	/**
	 * Adds a new unit.
	 * {UseCase "Messgrösse erstellen" and "Globale Messgrösse erstellen"}
	 * @param measurand Unit belongs to this measurand
	 * @param name Name of the unit. Example: Meter
	 * @param unitDivisor Divisor. Example: 0.001 when baseunit is KM (3 M : 0.001 = 0.003 KM)
	 * @param unitShift Shift. Example: Fahrenheit to Celsius, shift of 32
	 * @return True when unit was successfull created
	 */
	public boolean addPublicUnit(String measurand, String name, Double unitDivisor, Double unitShift, String symbol);

	/**
	 * Adds a new private unit.
	 * {UseCase "Masseinheit hinzufügen"}
	 * @param measurand Unit belongs to this measurand
	 * @param owner Unitowner
	 * @param name Name of the unit. Example: Meter
	 * @param unitDivisor Divisor. Example: 0.001 when baseunit is KM (3 M : 0.001 = 0.003 KM)
	 * @param unitShift Shift. Example: Fahrenheit to Celsius, shift of 32
	 * @return True when unit was successfull created
	 */
	public boolean addPrivateUnit(String measurand, String owner, String name, Double unitDivisor, Double unitShift, String symbol);

	/**
	 * Returns a list of all private Units.
	 * @param measurandName Measurand Name
	 * @param owner Owner of the Measurand
	 * @param username Username from User that is Logd in
	 * @return List with names of the private Units.
	 */
	public List<Unit> getPrivateUnitsMeasurand(String measurandName, String username);

	/**
	 * Returns a list of all public Units.
	 * @param measurandName Measurand Name
	 * @param username Username from User that is Logd in
	 * @return List with names of the public Units.
	 */
	public List<Unit> getPublicUnitsMeasurand(String measurandName);
}